﻿using AbpDemo.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;

namespace AbpDemo.Admins
{
    public class AdminRepository : EfCoreRepository<AbpDemoDbContext, Admin>, IAdminRepository
    {
        private readonly IDbContextProvider<AbpDemoDbContext> dbContextProvider;

        public AdminRepository(IDbContextProvider<AbpDemoDbContext> dbContextProvider) : base(dbContextProvider)
        {
            this.dbContextProvider = dbContextProvider;
        }

        public async Task<Admin> GetAdminAsync()
        {
            var dbset = await GetDbSetAsync();
            return dbset.FirstOrDefault();
        }
    }
}
